import request from "./request.ts";

// 登录
export const login = (data: LoginData) => {
  return request({
    url: "/acc/doLogin",
    method: "POST",
    data,
  });
};
// 获取当前用户信息
export const getSubject = (): Promise<apiServerResponse> => {
  return request({
    url: "/acc/getSubject",
    method: "GET",
  });
};
// 退出登录
export const logout = (): Promise<apiServerResponse> => {
  return request({
    url: "/acc/logout",
    method: "GET",
  });
};
// 获取当前用户的菜单
export const getMenus = (): Promise<apiServerResponse> => {
  return request({
    url: "/acc/menus",
    method: "GET",
  });
};
// 获取当前用户的权限
export const getPermissions = (): Promise<apiServerResponse> => {
  return request({
    url: "/acc/permissions",
    method: "GET",
  });
};
// 修改密码
export const updateUserPwd = (
  data: ModifyUserPwdData
): Promise<apiServerResponse> => {
  return request({
    url: "/acc/updatePwd",
    method: "POST",
    data,
  });
};
